﻿using System;
using System.Runtime.Serialization;

namespace Invoicing.Model.Products
{
    [DataContract]
    public class ProductStockModel:MBase
    {
        [Model(ConvertType = AttributeType.IgnoreUpdate)]
        [DataMember]
        public int ID { get; set; }
        [Model]
        [DataMember]
        public int ProductID { get; set; }
        [Model]
        [DataMember]
        public int MaterialID { get; set; }
        [Model]
        [DataMember]
        public int ProcessID { get; set; }
        [Model]
        [DataMember]
        public string Size { get; set; }
        [Model]
        [DataMember]
        public decimal Quantity { get; set; }
        [Model]
        [DataMember]
        public System.DateTime LastUpdateOn { get; set; }
        [Model]
        [DataMember]
        public int HouseID { get; set; }

        #region Help
        [DataMember]
        public ProductModel Product { get; set; }
        [DataMember]
        public string MaterialName { get; set; }
        [DataMember]
        public string ProcessName { get; set; }
        [DataMember]
        public string QuantityAndUnit
        {
            get
            {
                return string.Format("{0}({1})",Utils.StringExtension.RemoveLastZero(Quantity.ToString()), HouseID == 2 ? "斤" : "只");
            }
        }
        [DataMember]
        public decimal Ratio { get; set; }
        #endregion
    }
    [DataContract]
    public class ProductStockCollection : ModelCollectionBase<ProductStockModel> { }
}
